package com.glsc.ngateway.common.base.domain.mysql.gateway.other;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;


@Data
@Entity
@Builder
@Table(name = "t_am_digital_fees_item")
@org.hibernate.annotations.Table(appliesTo = "t_am_digital_fees_item", comment = "数字证书信息年费子表")
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
@EqualsAndHashCode(callSuper = false)
@AllArgsConstructor
@NoArgsConstructor
public class DigitalKeyFeesItem implements Serializable {
    private static final long serialVersionUID = 1500093744477965826L;

    @ApiModelProperty(value = "id")
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", columnDefinition = "int COMMENT 'id'")
    private String id;

    @ApiModelProperty(value = "数字证书信息年费主表id")
    @Column(name = "digital_fees_id", columnDefinition = "int COMMENT '数字证书信息年费主表id'")
    private String digitalFeesId;

    @ApiModelProperty(value = "交易单元号")
    @Column(name = "unit", columnDefinition = "varchar(40) COMMENT '交易单元号'")
    private String unit;

    @ApiModelProperty(value = "分摊比率")
    @Column(name = "rate", columnDefinition = "decimal(6,4) COMMENT '分摊比率'")
    private BigDecimal rate;

    @ApiModelProperty(value = "分摊费用")
    @Column(name = "bro_fare", columnDefinition = "decimal(15,4) COMMENT '分摊费用'")
    private BigDecimal broFare;

    @ApiModelProperty(value = "内部编码")
    @Column(name = "brn_org_no", columnDefinition = "varchar(40) COMMENT '内部编码'")
    private String brnOrgNo;

    @ApiModelProperty(value = "营业部名称")
    @Column(name = "brn_org_nm", columnDefinition = "varchar(255) COMMENT '营业部名称'")
    private String brnOrgNm;

    @ApiModelProperty(value = "营业部所属分公司编码")
    @Column(name = "comp_org_no", columnDefinition = "varchar(40) COMMENT '营业部所属分公司编码'")
    private String compOrgNo;

    @ApiModelProperty(value = "营业部所属分公司名称")
    @Column(name = "comp_org_nm", columnDefinition = "varchar(255) COMMENT '营业部所属分公司名称'")
    private String compOrgNm;

    @ApiModelProperty(value = "计费年度 格式：yyyy-MM-dd")
    @Column(name = "annual_fee_date", columnDefinition = "varchar(10) COMMENT '计费年度 格式：yyyy'")
    private String annualFeeDate;

//    @ApiModelProperty(value = "状态：0待发送 1已发送")
//    @Column(name = "status", columnDefinition = "varchar(10) COMMENT '状态：0待发送 1已发送'")
//    private String status;

    @ApiModelProperty(value = "交易所：sh 上海 sz深圳")
    @Column(name = "trading_post", columnDefinition = "varchar(10) COMMENT '交易所：sh 上海 sz深圳'")
    private String tradingPost;

    @ApiModelProperty(value = "创建时间")
    @Column(name = "create_time", columnDefinition = "datetime comment '创建时间'")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime createTime;

    @ApiModelProperty(value = "操作时间")
    @Column(name = "op_time", columnDefinition = "datetime comment '操作时间'")
    @org.hibernate.annotations.UpdateTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime opTime;
}

